<!--
  ~ Copyright 2005-2011 WSO2, Inc. (http://wso2.com)
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<axisconfig name="AxisJava2.0" xmlns:svns="http://org.wso2.securevault/configuration">

    <!-- ================================================= -->
    <!-- Globally engaged modules -->
    <!-- ================================================= -->
    <module ref="addressing"/>

    <!-- ================================================= -->
    <!-- Parameters -->
    <!-- ================================================= -->
    <parameter name="hotdeployment">${hotdeployment}</parameter>
    <parameter name="hotupdate">${hotupdate}</parameter>
    <parameter name="enableMTOM" locked="false">optional</parameter>
    <parameter name="cacheAttachments">true</parameter>
    <parameter name="attachmentDIR">work/mtom</parameter>
    <parameter name="sizeThreshold">4000</parameter>

    <parameter name="EnableChildFirstClassLoading">${childfirstCL}</parameter>

    <!--
    The exposeServiceMetadata parameter decides whether the metadata (WSDL, schema, policy) of
    the services deployed on Axis2 should be visible when ?wsdl, ?wsdl2, ?xsd, ?policy requests
    are received.
    This parameter can be defined in the axi2.xml file, in which case this will be applicable
    globally, or in the services.xml files, in which case, it will be applicable to the
    Service groups and/or services, depending on the level at which the parameter is declared.
    This value of this parameter defaults to true.
    -->
    <parameter name="exposeServiceMetadata">true</parameter>

    <!--If turned on with use the Accept header of the request to determine the contentType of the
    response-->
    <parameter name="httpContentNegotiation">true</parameter>

    <!--
    Defines how the persistence of WS-ReliableMessaging is handled

    Possible value are: inmemory & persistent
    -->
    <!-- Following parameter will completely disable REST handling in both the servlets-->
    <parameter name="disableREST" locked="false">false</parameter>

    <parameter name="Sandesha2StorageManager">inmemory</parameter>

    <!-- This deployment interceptor will be called whenever before a module is initialized or
     service is deployed -->
    <listener class="org.wso2.carbon.core.deployment.DeploymentInterceptor"/>

    <!-- setting servicePath. contextRoot is defined in the carbon.xml file -->
    <!-- modification of this variable should be accompanied by the change in 'ServerURL' in carbon.xml file -->
    <parameter name="servicePath">services</parameter>

    <!--the directory in which .aar services are deployed inside axis2 repository-->
    <parameter name="ServicesDirectory">axis2services</parameter>

    <!--the directory in which modules are deployed inside axis2 repository-->
    <parameter name="ModulesDirectory">axis2modules</parameter>

    <parameter name="userAgent" locked="true">
        @product.name@-@product.version@
    </parameter>
    <parameter name="server" locked="true">
        @product.name@-@product.version@
    </parameter>

    <!-- ========================================================================-->

    <!--During a fault, stacktrace can be sent with the fault message. The following flag will control -->
    <!--that behaviour.-->
    <parameter name="sendStacktraceDetailsWithFaults">false</parameter>

    <!--If there aren't any information available to find out the fault reason, we set the message of the expcetion-->
    <!--as the faultreason/Reason. But when a fault is thrown from a service or some where, it will be -->
    <!--wrapped by different levels. Due to this the initial exception message can be lost. If this flag-->
    <!--is set then, Axis2 tries to get the first exception and set its message as the faultreason/Reason.-->
    <parameter name="DrillDownToRootCauseForFaultReason">false</parameter>

    <!--Set the flag to true if you want to enable transport level session mangment-->
    <parameter name="manageTransportSession">true</parameter>

    <!-- Synapse Configuration file -->
    <parameter name="SynapseConfig.ConfigurationFile" locked="false">
        ./repository/deployment/server/synapse-configs
    </parameter>

    <!-- Synapse Home parameter -->
    <parameter name="SynapseConfig.HomeDirectory" locked="false">.</parameter>

    <!-- Resolve root used to resolve synapse references like schemas inside a WSDL -->
    <parameter name="SynapseConfig.ResolveRoot" locked="false">.</parameter>

    <!-- Synapse Server name parameter -->
    <parameter name="SynapseConfig.ServerName" locked="false">WSO2 Carbon Server</parameter>

    <!--By default, JAXWS services are created by reading annotations. WSDL and schema are generated-->
    <!--using a separate WSDL generator only when ?wsdl is called. Therefore, even if you engage-->
    <!--policies etc.. to AxisService, it doesn't appear in the WSDL. By setting the following property-->
    <!--to true, you can create the AxisService using the generated WSDL and remove the need for a-->
    <!--WSDL generator. When ?wsdl is called, WSDL is generated in the normal way.-->
    <parameter name="useGeneratedWSDLinJAXWS">${jaxwsparam}</parameter>

    <!-- Deployer for the dataservice. -->
    <!--<deployer extension="dbs" directory="dataservices" class="org.wso2.dataservices.DBDeployer"/>-->

    <!-- Axis1 deployer for Axis2-->
    <!--<deployer extension="wsdd" class="org.wso2.carbon.axis1services.Axis1Deployer" directory="axis1services"/>-->

    <!-- POJO service deployer for Jar -->
    <!--<deployer extension="jar" class="org.apache.axis2.deployment.POJODeployer" directory="pojoservices"/>-->

    <!-- POJO service deployer for Class  -->
    <!--<deployer extension="class" class="org.apache.axis2.deployment.POJODeployer" directory="pojoservices"/>-->

    <!-- JAXWS service deployer  -->
    <!--<deployer extension=".jar" class="org.apache.axis2.jaxws.framework.JAXWSDeployer" directory="servicejars"/>-->
    <!-- ================================================= -->
    <!-- Message Receivers -->
    <!-- ================================================= -->
    <!--This is the Default Message Receiver for the system , if you want to have MessageReceivers for -->
    <!--all the other MEP implement it and add the correct entry to here , so that you can refer from-->
    <!--any operation -->
    <!--Note : You can ovride this for particular service by adding the same element with your requirement-->

    <messageReceivers>
        <messageReceiver mep="http://www.w3.org/ns/wsdl/in-only"
                         class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
        <messageReceiver mep="http://www.w3.org/ns/wsdl/robust-in-only"
                         class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
        <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
                         class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>

    <messageFormatters>
        <messageFormatter contentType="application/x-www-form-urlencoded"
                          class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
        <messageFormatter contentType="multipart/form-data"
                          class="org.apache.axis2.transport.http.MultipartFormDataFormatter"/>
        <messageFormatter contentType="application/xml"
                          class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
        <messageFormatter contentType="text/xml"
                          class="org.apache.axis2.transport.http.SOAPMessageFormatter"/>
        <messageFormatter contentType="application/soap+xml"
                          class="org.apache.axis2.transport.http.SOAPMessageFormatter"/>

        <!--JSON Message Formatters-->
        <!--messageFormatter contentType="application/json"
                          class="org.apache.axis2.json.JSONMessageFormatter"/-->
        <messageFormatter contentType="application/json"
                                  class="org.apache.axis2.json.gson.JsonFormatter" />
        <messageFormatter contentType="application/json/badgerfish"
                          class="org.apache.axis2.json.JSONBadgerfishMessageFormatter"/>
        <!--messageFormatter contentType="text/javascript"
                          class="org.apache.axis2.json.JSONMessageFormatter"/-->
        <messageFormatter contentType="text/javascript"
                                  class="org.apache.axis2.json.gson.JsonFormatter" />

        <!--messageFormatter contentType="application/x-www-form-urlencoded"
                        class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
        <!--messageFormatter contentType="multipart/form-data"
                        class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
        <!--messageFormatter contentType="application/xml"
                        class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
        <!--messageFormatter contentType="text/html"
                        class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
        <!--messageFormatter contentType="application/soap+xml"
                        class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
        <!--messageFormatter contentType="x-application/hessian"
			class="org.apache.synapse.format.hessian.HessianMessageFormatter"/-->
        <!--<messageFormatter contentType="">
			class="org.apache.synapse.format.hessian.HessianMessageFormatter"/-->
    </messageFormatters>

    <messageBuilders>
        <messageBuilder contentType="application/xml"
                        class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
        <messageBuilder contentType="application/x-www-form-urlencoded"
                        class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
        <messageBuilder contentType="multipart/form-data"
                        class="org.apache.axis2.builder.MultipartFormDataBuilder"/>

        <!--JSON Message Builders-->
        <!--messageBuilder contentType="application/json"
                        class="org.apache.axis2.json.JSONOMBuilder"/-->
        <messageBuilder contentType="application/json"
                                class="org.apache.axis2.json.gson.JsonBuilder" />
        <messageBuilder contentType="application/json/badgerfish"
                        class="org.apache.axis2.json.JSONBadgerfishOMBuilder"/>
        <!--messageBuilder contentType="text/javascript"
                        class="org.apache.axis2.json.JSONOMBuilder"/-->
        <messageBuilder contentType="text/javascript"
                                class="org.apache.axis2.json.gson.JsonBuilder" />

        <!--messageBuilder contentType="application/xml"
     		        class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
        <!--messageBuilder contentType="application/x-www-form-urlencoded"
                        class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
        <!--messageBuilder contentType="multipart/form-data"
                        class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
        <!--messageBuilder contentType="multipart/related"
                       class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
        <!--messageBuilder contentType="application/soap+xml"
                       class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
        <!--messageBuilder contentType="text/plain"
                       class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
        <!--messageBuilder contentType="text/xml"
                       class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
        <!--messageFormatter contentType="text/plain"
                        class="org.apache.axis2.format.PlainTextBuilder"/-->
        <!--messageBuilder contentType="x-application/hessian"
		       class="org.apache.synapse.format.hessian.HessianMessageBuilder"/-->
    </messageBuilders>


    <!-- ================================================= -->
    <!-- In Transports -->
    <!-- ================================================= -->
    <transportReceiver name="http"
                       class="org.wso2.carbon.core.transports.http.HttpTransportListener">
        <!--
           Uncomment the following if you are deploying this within an application server. You
           need to specify the HTTP port of the application server
        -->
        <parameter name="port">9763</parameter>

        <!--
       Uncomment the following to enable any proxy like Apache2 mod_proxy or any load balancer. The port on the proxy server like Apache is 80
       in this case.
        -->
        <!--<parameter name="proxyPort">80</parameter>-->
    </transportReceiver>

    <!--Please uncomment this in Multiple Instance Scenario if you want to use NIO Transport Recievers and 
 	Remove the current transport REceivers in axis2.xml -->
    <!--transportReceiver name="http" class="org.apache.synapse.transport.nhttp.HttpCoreNIOListener">
        <parameter name="port" locked="false">8280</parameter>
        <parameter name="non-blocking" locked="false">true</parameter>
    </transportReceiver>
    
    <transportReceiver name="https" class="org.apache.synapse.transport.nhttp.HttpCoreNIOSSLListener">
        <parameter name="port" locked="false">8243</parameter>
        <parameter name="non-blocking" locked="false">true</parameter>
        <parameter name="keystore" locked="false">
            <KeyStore>
                <Location>repository/resources/security/wso2carbon.jks</Location>
                <Type>JKS</Type>
                <Password>wso2carbon</Password>
                <KeyPassword>wso2carbon</KeyPassword>
            </KeyStore>
        </parameter>
        <parameter name="truststore" locked="false">
            <TrustStore>
                <Location>repository/resources/security/client-truststore.jks</Location>
                <Type>JKS</Type>
                <Password>wso2carbon</Password>
            </TrustStore>
        </parameter>
    </transportReceiver-->


    <transportReceiver name="https"
                       class="org.wso2.carbon.core.transports.http.HttpsTransportListener">
        <!--
           Uncomment the following if you are deploying this within an application server. You
           need to specify the HTTPS port of the application server
        -->
        <parameter name="port">9443</parameter>

        <!--
       Uncomment the following to enable any proxy like Apache2 mod_proxy or any load balancer. The port on a proxy server like Apache is 443
       in this case.
        -->
        <!--<parameter name="proxyPort">443</parameter>-->
    </transportReceiver>

    <!--
       Uncomment the following segment to enable TCP transport.
       Note : Addressing module should be engaged for TCP transport to work
    -->
    <!--<transportReceiver name="tcp"
                       class="org.apache.axis2.transport.tcp.TCPServer">
        <parameter name="port">6667</parameter>
    </transportReceiver>-->

    <!--
     To Enable Mail Transport Listener, please uncomment the following.
    -->
    <!--<transportReceiver name="mailto" class="org.apache.axis2.transport.mail.MailTransportListener">

    </transportReceiver>-->


    <!--
      Uncomment this and configure as appropriate for JMS transport support,
      after setting up your JMS environment (e.g. ActiveMQ)
    -->
    <!--<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
        <parameter name="myTopicConnectionFactory">
        	<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
        	<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
        	<parameter name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</parameter>
        </parameter>

        <parameter name="myQueueConnectionFactory">
        	<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
        	<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
        	<parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
        </parameter>

        <parameter name="default">
        	<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
        	<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
        	<parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
        </parameter>
    </transportReceiver>-->

    <!--Uncomment this and configure as appropriate for JMS transport support with Apache Qpid -->
    <!--transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
        <parameter name="myTopicConnectionFactory" locked="false">
            <parameter name="java.naming.factory.initial" locked="false">org.apache.qpid.jndi.PropertiesFileInitialContextFactory</parameter>
            <parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
            <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
            <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
        </parameter>

        <parameter name="myQueueConnectionFactory" locked="false">
            <parameter name="java.naming.factory.initial" locked="false">org.apache.qpid.jndi.PropertiesFileInitialContextFactory</parameter>
            <parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
            <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
            <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
        </parameter>

        <parameter name="default" locked="false">
            <parameter name="java.naming.factory.initial" locked="false">org.apache.qpid.jndi.PropertiesFileInitialContextFactory</parameter>
            <parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
            <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
            <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
        </parameter>
    </transportReceiver-->

    <!--Uncomment this and configure as appropriate for JMS transport support with WSO2 MB 2.x.x -->
    <!--transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
        <parameter name="myTopicConnectionFactory" locked="false">
           <parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>
            <parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
            <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
            <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
        </parameter>

        <parameter name="myQueueConnectionFactory" locked="false">
            <parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>
            <parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
            <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
           <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
        </parameter>

        <parameter name="default" locked="false">
            <parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>
            <parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
            <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
            <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
        </parameter>
    </transportReceiver-->


    <!-- ================================================= -->
    <!-- Out Transports -->
    <!-- ================================================= -->

    <!--transportSender name="tcp"
                     class="org.apache.axis2.transport.tcp.TCPTransportSender"/-->
    <transportReceiver name="local"
                       class="org.wso2.carbon.core.transports.local.CarbonLocalTransportReceiver"/>
    <transportSender name="local"
                     class="org.wso2.carbon.core.transports.local.CarbonLocalTransportSender"/>
    <!--<transportSender name="jms"
                     class="org.apache.axis2.transport.jms.JMSSender"/>-->
    <transportSender name="http"
                     class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
        <parameter name="PROTOCOL">HTTP/1.1</parameter>
        <parameter name="Transfer-Encoding">chunked</parameter>
        <!-- This parameter has been added to overcome problems encounted in SOAP action parameter -->
        <parameter name="OmitSOAP12Action">true</parameter>
    </transportSender>
    <transportSender name="https"
                     class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
        <parameter name="PROTOCOL">HTTP/1.1</parameter>
        <parameter name="Transfer-Encoding">chunked</parameter>
        <!-- This parameter has been added to overcome problems encounted in SOAP action parameter -->
        <parameter name="OmitSOAP12Action">true</parameter>
    </transportSender>

    <!-- To enable mail transport sender, ncomment the following and change the parameters
         accordingly-->
    <!--<transportSender name="mailto"
                     class="org.apache.axis2.transport.mail.MailTransportSender">
        <parameter name="mail.smtp.from">wso2demomail@gmail.com</parameter>
        <parameter name="mail.smtp.user">wso2demomail</parameter>
        <parameter name="mail.smtp.password">mailpassword</parameter>
        <parameter name="mail.smtp.host">smtp.gmail.com</parameter>

        <parameter name="mail.smtp.port">587</parameter>
        <parameter name="mail.smtp.starttls.enable">true</parameter>
        <parameter name="mail.smtp.auth">true</parameter>
    </transportSender>-->

    <!--Please uncomment this in Multiple Instance Scenario if you want to use NIO sender -->
    <!--  
    <transportSender name="http" class="org.apache.synapse.transport.nhttp.HttpCoreNIOSender">
        <parameter name="non-blocking" locked="false">true</parameter>
    </transportSender>
    <transportSender name="https" class="org.apache.synapse.transport.nhttp.HttpCoreNIOSSLSender">
        <parameter name="non-blocking" locked="false">true</parameter>
        <parameter name="keystore" locked="false">
            <KeyStore>
                <Location>repository/resources/security/wso2carbon.jks</Location>
                <Type>JKS</Type>
                <Password>wso2carbon</Password>
                <KeyPassword>wso2carbon</KeyPassword>
            </KeyStore>
        </parameter>
        <parameter name="truststore" locked="false">
            <TrustStore>
                <Location>repository/resources/security/client-truststore.jks</Location>
                <Type>JKS</Type>
                <Password>wso2carbon</Password>
            </TrustStore>
        </parameter>
    </transportSender>
	-->


    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System pre defined phases       -->
        <!--
           The MsgInObservation phase is used to observe messages as soon as they are
           received. In this phase, we could do some things such as SOAP message tracing & keeping
           track of the time at which a particular message was received

           NOTE: This should be the very first phase in this flow
        -->
        <phase name="MsgInObservation"/>

        <phase name="Validation"/>
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="RequestURIOperationDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher" />
            <handler name="JSONMessageHandler"
                     class="org.apache.axis2.json.gson.JSONMessageHandler" />
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
                     class="org.wso2.carbon.core.multitenancy.MultitenantAddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Ghost">
            <handler name="GhostDispatcher"
                     class="org.wso2.carbon.core.dispatchers.GhostDispatcher"/>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>

            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
        </phase>
        <!--  System pre defined phases       -->
        <phase name="RMPhase"/>
        <phase name="OpPhase"/>
        <!--   After Postdispatch phase module author or or service author can add any phase he want      -->
        <phase name="OperationInPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!-- Handlers related to unified-endpoint component are added to the UEPPhase -->
        <phase name="UEPPhase"/>
        <phase name="RMPhase"/>
        <phase name="OpPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>

        <!--
           The MsgOutObservation phase is used to observe messages just before the
           responses are sent out. In this phase, we could do some things such as SOAP message
           tracing & keeping track of the time at which a particular response was sent.

           NOTE: This should be the very last phase in this flow
        -->
        <phase name="MsgOutObservation"/>
        <!--Following phase is added to publish stats -->
        <phase name="StatReporting"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <!--  System pre defined phases       -->
        <!--
           The MsgInObservation phase is used to observe messages as soon as they are
           received. In this phase, we could do some things such as SOAP message tracing & keeping
           track of the time at which a particular message was received

           NOTE: This should be the very first phase in this flow
        -->
        <phase name="MsgInObservation"/>

        <phase name="Validation"/>
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>

        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Ghost">
            <handler name="GhostDispatcher"
                     class="org.wso2.carbon.core.dispatchers.GhostDispatcher"/>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>

            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
        </phase>
        <phase name="RMPhase"/>
        <phase name="OpPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!-- Handlers related to unified-endpoint component are added to the UEPPhase -->
        <phase name="UEPPhase"/>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationOutFaultPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
	<phase name="Transport"/>
        <!--
           The MsgOutObservation phase is used to observe messages just before the
           responses are sent out. In this phase, we could do some things such as SOAP message
           tracing & keeping track of the time at which a particular response was sent.

           NOTE: This should be the very last phase in this flow
        -->
        <phase name="MsgOutObservation"/>
        <!--Following phase is added to publish stats -->
        <phase name="StatReporting"/>
    </phaseOrder>

    <clustering class="org.wso2.carbon.core.clustering.hazelcast.HazelcastClusteringAgent"
                enable="{{clustering.membership_scheme is defined}}">

        <!--
           This parameter indicates whether the cluster has to be automatically initalized
           when the AxisConfiguration is built. If set to "true" the initialization will not be
           done at that stage, and some other party will have to explictly initialize the cluster.
        -->
        <parameter name="AvoidInitiation">true</parameter>

        <!--
           The membership scheme used in this setup. The only values supported at the moment are
           "multicast" and "wka"

           1. multicast - membership is automatically discovered using multicasting
           2. wka - Well-Known Address based multicasting. Membership is discovered with the help
                    of one or more nodes running at a Well-Known Address. New members joining a
                    cluster will first connect to a well-known node, register with the well-known node
                    and get the membership list from it. When new members join, one of the well-known
                    nodes will notify the others in the group. When a member leaves the cluster or
                    is deemed to have left the cluster, it will be detected by the Group Membership
                    Service (GMS) using a TCP ping mechanism.
        -->
        <parameter name="membershipScheme">{{clustering.membership_scheme | default('multicast')}}</parameter>
        <!--<parameter name="licenseKey">xxx</parameter>-->
        <!--<parameter name="mgtCenterURL">http://localhost:8081/mancenter/</parameter>-->

        <!--
         The clustering domain/group. Nodes in the same group will belong to the same multicast
         domain. There will not be interference between nodes in different groups.
        -->
        <parameter name="domain">{{clustering.domain | default('wso2.carbon.domain')}}</parameter>

        <!-- The multicast address to be used -->
        <!--<parameter name="mcastAddress">228.0.0.4</parameter>-->

        <!-- The multicast port to be used -->
        <parameter name="mcastPort">45564</parameter>

        <parameter name="mcastTTL">100</parameter>

        <parameter name="mcastTimeout">60</parameter>

        <!--
           The IP address of the network interface to which the multicasting has to be bound to.
           Multicasting would be done using this interface.
        -->
        <!--
            <parameter name="mcastBindAddress">127.0.0.1</parameter>
        -->
        <!-- The host name or IP address of this member -->

        <parameter name="localMemberHost">{{clustering.local_member_host}}</parameter>

        <!--
            The bind adress of this member. The difference between localMemberHost & localMemberBindAddress
            is that localMemberHost is the one that is advertised by this member, while localMemberBindAddress
            is the address to which this member is bound to.
        -->
        <!--
        <parameter name="localMemberBindAddress">127.0.0.1</parameter>
        -->

        <!--
        The TCP port used by this member. This is the port through which other nodes will
        contact this member
         -->
        <parameter name="localMemberPort">{{clustering.local_member_port | default('4000')}}</parameter>

        {% for property_name,property_value in clustering.properties.items() %}
        <parameter name="{{property_name}}">{{property_value}}</parameter>
        {% endfor %}

        <!--
            The bind port of this member. The difference between localMemberPort & localMemberBindPort
            is that localMemberPort is the one that is advertised by this member, while localMemberBindPort
            is the port to which this member is bound to.
        -->
        <!--
        <parameter name="localMemberBindPort">4001</parameter>
        -->

        <!--
        Properties specific to this member
        -->
        <parameter name="properties">
            <property name="backendServerURL" value="https://${hostName}:${httpsPort}/services/"/>
            <property name="mgtConsoleURL" value="https://${hostName}:${httpsPort}/"/>
            <property name="subDomain" value="worker"/>
        </parameter>

        <!--
        Uncomment the following section to load custom Hazelcast data serializers.
        -->
        <!--
        <parameter name="hazelcastSerializers">
            <serializer typeClass="java.util.TreeSet">org.wso2.carbon.hazelcast.serializer.TreeSetSerializer
            </serializer>
            <serializer typeClass="java.util.Map">org.wso2.carbon.hazelcast.serializer.MapSerializer</serializer>
        </parameter>
        -->

        <parameter name="hazelcastSerializers">
            <serializer typeClass="org.wso2.andes.server.cluster.coordination.hazelcast.custom.serializer.wrapper.TreeSetLongWrapper">org.wso2.andes.server.cluster.coordination.hazelcast.custom.serializer.TreeSetLongWrapperSerializer</serializer>
            <serializer typeClass="org.wso2.andes.server.cluster.coordination.hazelcast.custom.serializer.wrapper.TreeSetSlotWrapper">org.wso2.andes.server.cluster.coordination.hazelcast.custom.serializer.TreeSetSlotWrapperSerializer</serializer>
            <serializer typeClass="org.wso2.andes.server.cluster.coordination.hazelcast.custom.serializer.wrapper.HashmapStringTreeSetWrapper">org.wso2.andes.server.cluster.coordination.hazelcast.custom.serializer.HashMapStringTreeSetWrapperSerializer</serializer>
        </parameter>

        <!--
           The list of static or well-known members. These entries will only be valid if the
           "membershipScheme" above is set to "wka"
        -->
        <members>
            {% for member in clustering.members %}
            {% set splittedMember = member.split(':') %}
            <member>
                <hostName>{{splittedMember[0]}}</hostName>
                <port>{{splittedMember[1]}}</port>
            </member>
            {% endfor %}
        </members>

        <!--
        Enable the groupManagement entry if you need to run this node as a cluster manager.
        Multiple application domains with different GroupManagementAgent implementations
        can be defined in this section.
        -->
        <groupManagement enable="false">
            <applicationDomain name="wso2.as.domain"
                               description="AS group"
                               agent="org.wso2.carbon.core.clustering.hazelcast.HazelcastGroupManagementAgent"
                               subDomain="worker"
                               port="2222"/>
        </groupManagement>
    </clustering>
</axisconfig>
